// part1:C11:ex11.3.cpp
// total of words.
#include <corecrt.h>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[])
{
    ifstream in(argv[1]);
    if (!in) {
        cout << "failed open input file!" << endl;
        exit(1);
    }

    map<string, size_t> word_count;
    string word;
    while (in >> word) {
        ++word_count[word];
        for (const auto &w : word_count) {
            cout << w.first << " is : " << w.second << endl;
        }
    }
    return 0;
}
